package com.aisile.admin.controller.v1;

import com.aisile.admin.service.AdChannelService;
import com.aisile.apis.admin.AdChannelControllerApi;
import com.aisile.model.admin.dtos.ChannelDto;
import com.aisile.model.admin.pojos.AdChannel;
import com.aisile.model.admin.pojos.AdSensitive;
import com.aisile.model.common.dtos.ResponseResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdChannelController implements AdChannelControllerApi {
    @Autowired
    private AdChannelService adChannelService;
//    @Autowired
//    private

    @Override
    public ResponseResult findByNameAndPage( ChannelDto dto){
        return adChannelService.findByNameAndPage(dto);
    }

    @PostMapping("/pageAdmin")
    @Override
    public ResponseResult getPageList(  ChannelDto dto) {
        return adChannelService.getPageList(dto);
    }
     @DeleteMapping("/deleteId/{id}")
    @Override
    public ResponseResult deleteId(@PathVariable int id) {
        return adChannelService.deleteId(id);
    }

    @Override
    public ResponseResult findListByPage(ChannelDto dto) {
        return null;
    }

     @PostMapping("/save")
    @Override
    public ResponseResult saveAdChannel(@RequestBody AdChannel adChannel) {
        return adChannelService.saveAdChannel(adChannel);
    }
     @PutMapping("/update")
    @Override
    public ResponseResult updateAdChannel( @RequestBody AdChannel adChannel) {
        return adChannelService.updateAdChannel(adChannel);
    }
    @PutMapping("/updateStatus/{id}")
    @Override
    public ResponseResult updateStatus(@PathVariable int id) {

        return adChannelService.updateStatusy(id,true);
    }
    @PutMapping("/updateyStatus/{id}")
    @Override
    public ResponseResult updateyStatus(@PathVariable int id) {
        return adChannelService.updateyStatusy(id,false);
    }
   @PostMapping("/daochu")
    @Override
    public ResponseResult daoChu() {

        return adChannelService.exportData();
    }
   @GetMapping("/checkExportResultInRedis")
    @Override
    public ResponseResult daoChu2() {
        return adChannelService.checkExportResultInRedis();
    }


//  @PutMapping("/updateStatus/{id}")
//    @Override
//    public ResponseResult updateCahnnelStatusById(@PathVariable Integer id) {
//        return adChannelService.updateCahnnelStatusById(id,);
//    }




}
